/*
 * Copyright 2007 - The JDPF Project Team (http://www.jdpf.org) 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */
package org.jdpf.plugins.datatypes.basic;

import java.util.ArrayList;
import java.util.List;

import javax.measure.Measure;

import org.jdpf.core.plugins.datatypes.Series;

/**
 * This is a series of Measure(s) defined on the JScience class Measure 
 * which represents the result of a measurement stated in a known unit.
 * The value can be int, long, float or double.
 * 
 * @author Paolo Ciccarese
 *
 */
public class MeasureSeries extends Series {

	public MeasureSeries() {
		super(new ArrayList<MeasureAdapter>());
	}
	
	@SuppressWarnings("unchecked")
	public List<MeasureAdapter> getValue(){
		return super.getValue();
	}
	
	public MeasureAdapter getFirst(){
		return (MeasureAdapter) super.getFirst();
	}
	
	public MeasureAdapter getLast(){
		return (MeasureAdapter) super.getLast();
	}
	
	public MeasureAdapter getElement(int i){
		return (MeasureAdapter)super.getElement(i);
	}
	
	public void addElement(MeasureAdapter o){
		getValue().add(o);
	}

	@Override
	public boolean isEmpty() {
		return (getValue().size()==0);
	}
}
